<template>
	<view class="detailed">
		<div class="title">
			<p>{{detail.pname}}</p>
			<span>{{detail.endtime}}</span>
		</div>
		<div class="cent">
			<image :src="detail.url" mode=""></image>
			<view v-html="detail.desc1"></view>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				detail:'',
				userInfo:uni.getStorageSync('userInfo')
			};
		},
		onLoad(option) {
			this.id = option.id
			this.getCoursedetail(option.id)
			
			if (option.maincode) {
				uni.setStorageSync('maincode', option.maincode);
			}
		},
		onShareAppMessage(){
			let pages = getCurrentPages()
			pages = pages[pages.length-1].route
		    return {
		        title: '弹出分享时显示的分享标题',
		        desc: '分享页面的内容',
		        path: `${pages}?maincode=${this.userInfo.maincode}&id=${this.id}`, // 路径，传递参数到指定页面。
				imageUrl:'@/static/bg.jpg'
		    }
		},
		methods:{
			getCoursedetail(id){
				this.$api('api/tcc/getCoursedetail',{courseid:id}).then(res=>{
					this.detail=res
				})
			}
		}
	}
</script>

<style lang="less" scoped>
.detailed{
	padding: 40rpx;
	.title{
		p{font-size: 36rpx;font-weight: bold;color: #666;}
		span{font-size: 18rpx;color: #989898;margin-top: 20rpx;}
	}
	.cent{
		>image{
			width: 100%;
			height: 380rpx;
		}
		margin-top: 30rpx;color: #666;
		p{margin-bottom: 20rpx;color: #666;}
	}
}
</style>
